﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<OptimumInfra.ViewData.ViewDataOrder>" %>
<%@ Import Namespace="OptimumInfra.Models" %>

<asp:Content ID="Content3" ContentPlaceHolderID="AdminContent" runat="server">
    <h2>Edit Template</h2>

        <% using (Html.BeginForm()) { %>

        <%: Html.ValidationSummary(true, "Account creation was unsuccessful. Please correct the errors and try again.")%>
                <legend>Template Information</legend>
                <br/ />
          <table width="700" style="margin-top: 10px;">
          <tr>
          <td>          
                <div class="editor-label">
                    <%: Html.LabelFor(template => template.ProductName)%>
                </div>
            </td> 
            <td>
                <div class="editor-field">
                    <%: Html.TextBoxFor(template => template.FirstName)%>
                    <%: Html.ValidationMessageFor(template => template.FirstName)%>
                </div>
           </td> 
          </tr>

            <tr>
               <td colspan="2">
                <p>
                    <input type="submit" value="Update" />
                </p>
                </td>
            </tr>         
                
            </table>
          <% List<OrderProduct> orderProduct = Model.OrderProduct;
             if (orderProduct.Count > 0) 
               {                
                %> 
            Templates
          <table width="700" style="margin-top: 10px;">
          <tr>
            <th>--</th>
             <th>Name</th>
             <th>Quatity</th>
             <th>Price</th>
          </tr>
          <%  foreach (OrderProduct template in orderProduct)
              {   %>
          <tr>
          <td></td>
          <td>          
              <div class="editor-label">
                    <%=template.ProductName %>
               </div>
            </td>
           <td><div class="editor-label">
                    <%=template.Quatity %>
               </div>
            </td>
            <td><div class="editor-label">
                    <%=template.Price %>
               </div>
             </td>  
          </tr>
         <%
              }        
           %>                
            </table>
            <% 
            }
            %>

    <% } %>
    <script type="text/javascript">
        $(document).ready(function () {

            $("#orderCreate").validate({
                rules: {
                    Name: "required", // simple rule, converted to {required:true} 
                    CategoryId: "required",
                    Price: {
                        required: true,
                        number: true
                    }
                },
                messages: { Name: "* Name is required", CategoryId: "* Please select category", Price: "Must be number" }

            });
        }); 
	  </script>
</asp:Content>
